package com.itheima.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.commen.Result;
import com.itheima.entiry.Category;
import com.itheima.entiry.Dish;
import com.itheima.entiry.OrderDetail;
import com.itheima.entiry.ValueName;
import com.itheima.mapper.StaticsMapper;
import com.itheima.service.CategoryService;
import com.itheima.service.DishService;
import com.itheima.service.OrderDetailService;
import com.itheima.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/statics")
public class StaticsController {
    @Autowired
    private DishService dishService;

    @Autowired
    private StaticsMapper staticsMapper;

    @Autowired
    private OrderDetailService orderDetailService;

    @Autowired
    private CategoryService categoryService;

    @Autowired
    private SetmealService setmealService;


    @GetMapping("/dishCash")
    public Result dishCategoryCash(){

        List<ValueName> valueNameDishList=staticsMapper.getSum();


        Map map = new HashMap();
        map.put("dishCategoryCash",valueNameDishList);

        return new Result(1,map);
    }

    @GetMapping("/setmealCash")
    public Result dishCategoryCash2(){

        List<ValueName> valueNameSetList=staticsMapper.getSum2();


        Map map = new HashMap();
        map.put("setmealCash",valueNameSetList);

        return new Result(1,map);
    }

    @GetMapping("/dishNum")
    public Result dishCategoryCash3(){

        List<ValueName> valueNameDishList=staticsMapper.getCount();


        Map map = new HashMap();
        map.put("dishNum",valueNameDishList);

        return new Result(1,map);
    }

    @GetMapping("/setmealNum")
    public Result dishCategoryCash4(){

        List<ValueName> valueNameSetList=staticsMapper.getCount2();


        Map map = new HashMap();
        map.put("setmealNum",valueNameSetList);

        return new Result(1,map);
    }
    @GetMapping("/cashPerMonth")
    public Result cashPerMonth(){
        List<ValueName> valueNameList = staticsMapper.cashPerMonth();
        Map map = new HashMap();
        map.put("setmealNum",valueNameList);
        return new Result(1,map);
    }


}
